//
//  FWFriendTrendsController.m
//  BirdLoveSheep
//
//  Created by wwj on 16/3/8.
//  Copyright © 2016年 wwj. All rights reserved.
//

#import "FWFriendTrendsController.h"
#import "UIBarButtonItem+Extension.h"
#import "FWAttentionController.h"
#import "FWTitleView.h"
#import "FWAttentMainController.h"
#import "FWAttentOrderController.h"

@interface FWFriendTrendsController ()<TitleViewDelegate>
@property (weak, nonatomic) FWAttentMainController *mainVC;
@property (weak, nonatomic) FWAttentOrderController *orderVC;
@end

@implementation FWFriendTrendsController

- (void)viewDidLoad{
    [super viewDidLoad];
    [self initView];
    [self initChildView];
}

- (void)initView{
    self.view.backgroundColor = kBgColor;
    FWTitleView *titleView = [FWTitleView titleView];
    titleView.delegate = self;
    self.navigationItem.titleView = titleView;
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem fw_itemWithIcon:@"friendsRecommentIcon" highIcon:@"friendsRecommentIcon-click" target:self action:@selector(onClickLeftBtn)];
}

- (void)initChildView{
    FWAttentMainController *mainVC = [[FWAttentMainController alloc] init];
    [self addChildViewController:mainVC];
    _mainVC = mainVC;
    
    FWAttentOrderController *orderVC = [[FWAttentOrderController alloc] init];
    [self addChildViewController:orderVC];
    _orderVC = orderVC;
    
    [self onClickTitleViewFrom:0 to:0];

}

- (void)onClickLeftBtn{
    [self.navigationController pushViewController:[[FWAttentionController alloc] init] animated:YES];
}

- (void)onClickTitleViewFrom:(NSInteger)from to:(NSInteger)to{
    UIViewController *childVC = self.childViewControllers[from];
    [childVC.view removeFromSuperview];
    
    UIViewController *newVC = self.childViewControllers[to];
    newVC.view.frame = self.view.frame;
    [self.view addSubview:newVC.view];
    
}


@end
